<template>
  <div class="page adaofu-loading">
    <div class="container" :style="bg">
      <div class="main-section">
        <div class="loading">
          <div class="loading-bar">
            <div class="loading-bar-inner" :style="loadingBarStyle"></div>
          </div>
          <div class="loading-text">{{percent}}%</div>
        </div>
        <p>挑剔的你，需要独特的香<br/>欢迎光临阿道夫香氛街</p>
      </div>
    </div>
  </div>
</template>

<script>
import { sourceDomain } from '@/utils/constant'

export default {
  components: {
  },
  data () {
    return {
      icons: {
        bg: `${sourceDomain}/bg1.png`,
      },
      timer: null,
      percent: 0
    }
  },
  computed: {
    bg () {
      return `background-image: url(${this.icons.bg});`
    },
    loadingBarStyle () {
      return `width: ${this.percent}%;`
    }
  },
  mounted () {
    this.doLoading()
  },
  methods: {
    doLoading () {
      this.timer = setInterval(() => {
        if (this.percent < 100) {
          this.percent = parseInt(this.percent) + 1
        }
      }, 20)
    }
  }
}
</script>

<style lang="less" scoped>
.adaofu-loading {
  .container {
    position: relative;
    min-height: 100%;
    min-height: 100vh;
    background-size: 100% auto;
    background-repeat: no-repeat;
    background-position: center center;
  }
  .main-section {
    position: absolute;
    top: 50%;
    left: 0;
    margin-top: 4rpx;
    width: 100%;
    text-align: center;
    .loading {
      &-bar {
        position: relative;
        width: 266rpx;
        height: 12rpx;
        background-color: #41151a;
        border-radius: 9rpx 9rpx;
        margin: 0 auto;
        padding: 3rpx 3rpx;
        &-inner {
          width: 0%;
          height: 12rpx;
          background: url("../../../static/images/loading/loading-bg.png") repeat-x center center;
          background-size: contain;
          border-radius: 6rpx 6rpx;
        }
      }
      &-text {
        font-size: 20rpx;
        color: #000;
        padding-top: 4rpx;
      }
    }
    p {
      font-size: 26rpx;
      color: #260000;
      padding-top: 40rpx;
    }
  }
}
</style>
